using System.Collections.Generic;
using System.Reflection;

namespace HardMock.Domain
{
    class MethodCall
    {
        public string Assembly { get; private set; }
        public string Type { get; private set; }
        public string Name { get; private set; }
        public IEnumerable<Argument> Arguments { get; private set; }

        public MethodCall(string assembly, string type, string name, IEnumerable<Argument> arguments)
        {
            Assembly = assembly;
            Type = type;
            Name = name;
            Arguments = arguments;
        }

        public MethodCall(MemberInfo methodInfo, IEnumerable<Argument> arguments)
        {
            Assembly = methodInfo.Module.Assembly.GetName().Name;
            // ReSharper disable PossibleNullReferenceException
            Type = methodInfo.DeclaringType.FullName;
            // ReSharper restore PossibleNullReferenceException
            Name = methodInfo.Name;
            Arguments = arguments;
        }
    }
}